package com.mql.ganio.ui.fragment;

import com.jcodecraeer.xrecyclerview.XRecyclerView;
import com.mql.ganio.MainActivity;
import com.mql.ganio.R;
import com.mql.ganio.ui.base.BaseFragment;
import com.mql.ganio.ui.presenter.CustomAtPresenter;
import com.mql.ganio.ui.view.IGanHuoAtView;
import com.youth.banner.Banner;

import butterknife.Bind;


/**
 * @创建者 mql
 * @描述 大安卓fragment
 */

public class AndroidFragment extends BaseFragment<IGanHuoAtView,CustomAtPresenter> implements IGanHuoAtView,XRecyclerView.LoadingListener {
    private String mType = "Android";
    @Bind(R.id.xrv_custom)
    XRecyclerView mXrvCustom;
    int page=1;
    @Override
    public void initListener() {
        super.initListener();
        mXrvCustom.setLoadingListener(this);

    }


    @Override
    public void initData() {
        super.initData();
        mPresenter.refreshData(page);
    }
    @Override
    protected CustomAtPresenter createPresenter() {
        return new CustomAtPresenter((MainActivity) getContext(),mType);
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.fragment_custom;
    }

    @Override
    public XRecyclerView getXRecyclerView() {
        return mXrvCustom;
    }

    @Override
    public Banner getBanner() {
        return null;
    }

    @Override
    public void onRefresh() {
        page=1;
        mPresenter.refreshData(page);
    }

    @Override
    public void onLoadMore() {
        page++;
        mPresenter.refreshData(page);
    }
}
